package com.pronosticos.reportes.dao.impl;

import java.util.Date;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.pronosticos.reportes.dao.MelateRetroDAO;
import com.pronosticos.reportes.entity.MelateRetroEntity;

@Transactional
@Repository
public class MelateRetroDAOImpl extends GenericDaoImpl<MelateRetroEntity, Long>
implements MelateRetroDAO {

    public MelateRetroDAOImpl() {
        super(MelateRetroEntity.class);
    }

    public MelateRetroDAOImpl(final Class<MelateRetroEntity> clazz,
            final SessionFactory sessionFactory) {
        super(MelateRetroEntity.class, sessionFactory);
    }

    @Override
    public List<MelateRetroEntity> findCoincidencias(final Integer b1,
            final Integer b2, final Integer b3, final Integer b4,
            final Integer b5, final Integer b6, final Integer ba,
            final Integer numSorteos) {

        return null;
    }

    @Override
    public List<MelateRetroEntity> findNumAmigos(final Integer b1,
            final Integer numSorteos, final Boolean isAdicional) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Integer getBolaFrecuenciaMedia(final Integer valorBola,
            final Integer numSorteos, final Boolean isAdicional) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Integer getBolaFrecuenciaMediaPosicion(final Integer valorBola,
            final Integer numSorteos, final Boolean isAdicional) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Integer getBolaMaxSorteo(final Integer valorBola,
            final Integer numSorteos, final Boolean isAdicional) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Date getBolaMaxSorteoFecha(final Integer valorBola,
            final Integer numSorteos, final Boolean isAdicional) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Integer getBolaVeces(final Integer valorBola,
            final Integer numSorteos, final Boolean isAdicional) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public Integer getCount() {
        // TODO Auto-generated method stub
        return 55;
    }

    @Override
    public Integer getMaxSorteo() {
        final Session session = sessionFactory.getCurrentSession();
        final Query q = session
                .createQuery("select count(u.pkProducto) from TblProductos u");
        final Number count = (Number) q.uniqueResult();
        return count.intValue();
    }

    @Override
    public Integer getMaxSorteoFecha() {
        final Session session = sessionFactory.getCurrentSession();
        final Query q = session
                .createQuery("select max(u.fecha) from TblProductos u");
        final Number count = (Number) q.uniqueResult();
        return count.intValue();
    }

}
